package com.patni.frame.util;


import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class MyScrollIcon extends JLabel{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static JLabel middleTemp
		=getMiddleTemp();

	public static JLabel upTemp=getUpTemp();
	public static JLabel downTemp=getDownTemp();

	public static JLabel getMidlle(int height,int type){
		if(type<0||type>2){
		return null;
		}
		
		JLabel jl=new JLabel();
		jl.setLayout(null);
		jl.setBounds(0, 0, 15, height);
		
		int j=height/200;
	
			
			switch(type){
			case 0:
				for(int i=0;i<=j;i++){
				JLabel jj= middleTemp;
				jj.setLocation(0, i*200);
				jl.add(middleTemp);
				}
				break;
			case 1:
				for(int i=0;i<j;i++){
					JLabel jj= middleTemp;
					jj.setLocation(7, i*200);
					jl.add(middleTemp);
					}
				break;
			case 2:
				for(int i=0;i<j;i++){
					JLabel jj= middleTemp;
					jj.setLocation(15, i*200);
					jl.add(middleTemp);
					}
			break;
			}
		
		return jl;
	}
	
	public static JLabel getud(int flag,int type){
		if(type<0||type>1||flag>1||flag<0){
		return null;
		}
		JLabel jl=new JLabel();
		jl.setLayout(null);
		jl.setBounds(0,0,15,15);

		switch(type){
		case 0:
		
			switch(flag){
			case 0:upTemp.setLocation(0, 0);jl.add(upTemp);break;
			case 1:upTemp.setLocation(1, -2);jl.add(upTemp);break;
			}
			;break;
		case 1:

			switch(flag){
			case 0:downTemp.setLocation(0, 0);jl.add(downTemp);break;
			case 1:downTemp.setLocation(1, 2);jl.add(downTemp);break;
			}
			;break;
		}

		return jl;
	}
	
	public static JLabel getMiddleTemp(){
		JLabel temp=new JLabel();
		temp.setLayout(null);
		temp.setSize(30, 200);
		JLabel zuoTemp=new JLabel();
		JLabel youTemp=new JLabel();
		Icon zuoIcon=new ImageIcon("bodyImage/zuo.png");
		Icon youIcon=new ImageIcon("bodyImage/you.png");
		zuoTemp.setBounds(0,0,15, 200);
		youTemp.setBounds(14,0,15, 200);
		zuoTemp.setIcon(zuoIcon);
		youTemp.setIcon(youIcon);
		temp.add(zuoTemp);
		temp.add(youTemp);
		return temp;
	}
	public static JLabel getUpTemp(){
		Icon upIcon=new ImageIcon("bodyImage/up.png");
		JLabel upTemp=new JLabel();
		upTemp.setSize(15, 15);
		upTemp.setIcon(upIcon);
		return upTemp;
	}
	public static JLabel getDownTemp(){
		Icon upIcon=new ImageIcon("bodyImage/down.png");
		JLabel upTemp=new JLabel();
		upTemp.setSize(15, 15);
		upTemp.setIcon(upIcon);
		return upTemp;
	}
	public static void main(String[] args){
		JFrame j=new JFrame("ll");
		j.setSize(500,500);
		j.setLayout(null);
		JLabel jl=MyScrollIcon.getMiddleTemp();
		jl.setLocation(0, 0);
		j.add(jl);
		j.setVisible(true);
	}
}
